package cn.bonoon.kernel.io;

import javax.servlet.http.HttpServletResponse;

public enum HttpLoadingType {
	
	DOWNLOAD{
		@Override
		public void loading(HttpServletResponse response, HttpStorageFile hsFile) throws Exception {
			response.setContentType(HttpStorageFile.DEFAULT_CONTENT_TYPE);
			response.setHeader("Content-Disposition", "attachment;fileName=" + hsFile.encodeFilename());
		}
	},
	
	OPEN{
		@Override
		public void loading(HttpServletResponse response, HttpStorageFile hsFile) throws Exception{
			response.setContentType(hsFile.getContentType());
		}
	};
	
	public void loading(HttpServletResponse response, HttpStorageFile hsFile) throws Exception{ }
}
